package com.weixing.mall.provider.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.weixing.mall.provider.api.model.dto.GoodPrintRpcDto;
import com.weixing.mall.provider.api.model.vo.ActOrderSettleVo;
import com.weixing.mall.provider.api.model.vo.ProductStockDetailsVo;
import com.weixing.mall.provider.api.model.vo.SealingSheetOrderVo;
import com.weixing.mall.provider.api.model.vo.TransferListVo;
import com.weixing.mall.provider.model.domain.Order;
import com.weixing.mall.provider.model.dto.*;
import com.weixing.mall.provider.model.query.*;
import com.weixing.mall.provider.model.vo.*;
import com.weixing.mall.provider.model.vo.member.MemberOrderVo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单模块-订单表 Mapper 接口
 * </p>
 *
 * @author Small
 * @since 2019-11-20
 */
public interface OrderMapper extends BaseMapper<Order> {

    OrderDetilVo selectOrderDetails(long id);

    OrderDetilTimeVo selectOrderDetailsTime(long id);

    void updateOrderStatus(@Param("qs") ChgOrderStatusDto chgOrderStatusDto);

    void updateOrderPayStatus(@Param("qs") ChgOrderPayStatusDto chgOrderPayStatusDto);

    IPage<OrderListPCVo> selectListPC(@Param("pg") Page page, @Param("qs") OrderPCQuery orderPCQuery, @Param("array") Long[] types);

    List<OrderListPCVo> selectListPC(@Param("qs") OrderPCQuery orderPCQuery, @Param("array") Long[] types);
    List<GoodPrintRpcDto> selectPrintList(@Param("qs") OrderPCQuery orderPCQuery);
    void PushOrderSn(long id);

    IPage<OrderUntyingVo> selectUntyingList(@Param("pg") Page page, @Param("qs") OrderUntyingQuery orderUntyingQuery);

    IPage<OrderListPCVo> selectDistributionShipperList(@Param("pg") Page page, @Param("qs") OrderPCQuery orderPCQuery);

    IPage<OrderListPCVo> selectDeliverOrderList(@Param("pg") Page page, @Param("qs") OrderPCQuery orderPCQuery);
    StaticVo deliverOrderTotal(@Param("qs") OrderPCQuery orderPCQuery);

    void distributionShipper(List<DistributionShipperDto> distributionShipperDtoList);

    void shipperChgOrder(@Param("qs") ShipperChgOrderDto shipperChgOrderDto);

    IPage<GoodsIdentificationVo> goodsIdentification(@Param("pg") Page page, @Param("qs") GoodsIdentificationQuery goodsIdentificationQuery);

    List<GoodsIdentificationVo> goodsIdentification(@Param("qs") GoodsIdentificationQuery goodsIdentificationQuery);

    IPage<KefuAuditOrderVo> selectAgentPlaceOrderList(@Param("pg") Page page, @Param("qs") AgentPlaceOrderQuery agentPlaceOrderQuery);

    IPage<AgentClaimVo> selectAgentClaimList(@Param("pg") Page page, @Param("qs") AgentClaimQuery agentClaimQuery);

    IPage<FrontCustomerOrderVo> selectCustomerOrderList(@Param("pg") Page page, @Param("qs") FrontCustomerOrderQuery frontCustomerOrderQuery);

    FrontCustomerOrderDetailsVo selectFrontCustomerOrderDetails(Long id);

    OrderShowVo selectOrderShowVo(@Param("qs") OrderVoQuery orderVoQuery);

    IPage<MemberOrderVo> seachOrderList(@Param("pg") Page page, @Param("qs") OrderSeachQuery orderSeachQuery);

    void updateFrontOrderStatus(@Param("qs") ChgFrontOrderStatusDto chgFrontOrderStatusDto);

    IPage<FrontShipperUnshippedOrderVo> unshippedOrder(@Param("pg") Page page, @Param("qs") ShipperOrderQuery shipperOrderQuery);

    IPage<FrontShipperUnshippedOrderVo> deliverOrderList(@Param("pg") Page page, @Param("qs") ShipperOrderQuery shipperOrderQuery);

    void updateGoodsStatus(@Param("qs") FrontShipperUpdateGoodsStatusDto frontShipperUpdateGoodsStatusDto);

    IPage<OutOfStockCancelOrderVo> selectOutOfStockList(@Param("pg") Page initMpPage, @Param("qs") CustomerOrderQuery customerOrderQuery, @Param("agentIds") Long[] agentIds);

    StaticVo selectOutOfStockListTotal(@Param("qs") CustomerOrderQuery customerOrderQuery, @Param("agentIds") Long[] agentIds);

    ScanCodeGoodsDetilVo selectScanCodeGoodsDetil(@Param("qs") ScanCodeGoodsDetilQuery scanCodeGoodsDetilQuery);

    ScanCodeAfterSaleVo selectScanCodeReceiveDetil(@Param("qs") ScanCodeGoodsDetilQuery scanCodeGoodsDetilQuery);

    List<FrontAgentCliamOrderVo> selectFrontAgentOrderCanClaimlist(String[] orderSnArr);


    FrontAgentOrderDetilsVo selectFrontAgentOrderDetils(@Param("id") Long id);

    IPage<OrderListPCVo> historyOrder(@Param("pg") Page initMpPage, @Param("qs") OrderPCQuery orderQuery);

    IPage<OrderListPCVo> sealedBillOrder(@Param("pg") Page initMpPage, @Param("qs") OrderPCQuery orderQuery);

    IPage<SealingSheetOrderVo> sealingSheetOrderList(@Param("pg") Page initMpPage, @Param("qs") SealingSheetOrderQuery sealingSheetOrderQuery, @Param("orderStatus") Integer orderStatus,@Param("isCreatedBill") Integer isCreatedBill);

    List<SealingSheetOrderVo> sealingSheetOrderLists(@Param("orderStatus") Integer orderStatus);

    IPage<KefuAuditOrderVo> toAudit(@Param("pg") Page initMpPage, @Param("qs") CustomerOrderQuery customerOrderQuery);

    StaticVo toAuditTotalAmount(@Param("qs") CustomerOrderQuery customerOrderQuery);

    int getCountfrontOrder(@Param("memberId") Long memberId, @Param("orderFrom") Integer orderFrom, @Param("frontOrderStatus") Integer frontOrderStatus);

    IPage<TransferListVo> byDepotId(@Param("pg") Page initMpPage, Long depotId);

    List<TransferListVo> byDepotId(Long depotId);

    void updateStatus(Integer depotId);

    void updateNoSuppllyAudit(@Param("id") Long id, @Param("nosuppllyAudit") Integer nosuppllyAudit, @Param("date") Date date);

    void updateCustomerRemark(@Param("qs") ChgKefuRemarkDto customerChgRemarkOrderDto);

    /*以下是报表模块的接口*/
    IPage<CommoditySalesVo> findCommodityDepartSale(@Param("pg") Page initMpPage, @Param("qs") CommoditySalesQuery commoditySalesQuery, @Param("array") Long[] productIds);

    CommoditySalesVo selectWhole(CommoditySalesQuery commoditySalesQuery);

    /* 后台首页统计接口 */
    List<IndexSaleReportVo> selectAdminIndexSaleReport(String startTime, String endTime);


    List<ActOrderSettleVo> selectAgentActOrdersByActId(Long actId);

    IPage<KefuAuditOrderVo> noBindKefu(@Param("pg") Page page, @Param("qs") CustomerOrderQuery query);

    StaticVo noBindKefuTotalAmount(@Param("qs") CustomerOrderQuery query);

    IPage<FrontAgentOrderVo> selectAgentOrderList(@Param("pg") Page page, @Param("qs") AgentOrderQuery query);

    Map<String,Object> selectAgentOrderListPriceTotal( @Param("qs") AgentOrderQuery query);

    List<FrontAgentOrderVo> selectAgentOrderList(@Param("qs") AgentOrderQuery query);

    StaticVo countAndSumAgentOrder(@Param("qs") AgentStatisticQuery query);
    StaticVo countAndSumAgentSaleOrder(@Param("qs") AgentOrderQuery query);

    List<OrderBillInfoVo> selectOrderBillInfoList(@Param("orderIds")String[] orderIds,@Param("isCreatedBill")Integer isCreatedBill);

    void autoConfirmOrder(@Param("map")Map<String,Integer> map);

    StaticVo agentAchievement(@Param("qs")AgentOrderQuery query);

    IPage<KefuAuditOrderVo> agentAuditHis(@Param("pg") Page initMpPage, @Param("qs") AgentAuditHisQuery query);

    AuditHisCntVo auditHisListSta(@Param("qs") AgentAuditHisQuery query);

    List<Order> selectCliamOrderlistByIdedCodes(String[] orderSnArr);

    void orderUnbound(@Param("array")List<Long> ids);

    Integer loadAdminIndex(String type);

    void orderResetStatus(@Param("id")Long id);

    void OrderBound(@Param("qs")OrderBoundDto orderBoundDto);

    IPage<FrontAgentOrderVo> selectUpPayOrderList(@Param("pg")Page page, @Param("qs")AgentOrderQuery query);

    List<ProductStockDetailsVo> getAllByDepotId(@Param("depotId")Long tt);

    IPage<KefuAuditOrderVo> selectKefuOrderList(@Param("pg") Page page, @Param("qs")CustomerOrderQuery query);
}
